<?php if(!defined('SIDELOADED')) { echo 'Direct access is not allowed.'; }
/**
 * @author Tyil <info@tyil.nl>
 * @version 1.0 beta [18-04-2012]
 */

if(Session::Get('user') > 0) {
  
  if(@${1} > 0) {
    // Fetching a member's profile
    
    
    
  } else {
    // Show the memberlist
  
    if(!isset($page) || $page < 0) { $page = 0; }
    
    $start = (int)$page * 30;
    
    $db = new Database();
    $result = $db->Query('SELECT `id` FROM `users` ORDER BY `account` ASC LIMIT ' . $start . ', 30;');
    $total = $db->Count('users');

    Website::View('page', array(
      'title' => 'Memberlist',
      'content' => Website::View('members/list', array(
        'page' => $page,
        'members' => $result,
        'total' => $total,
        'lastpage' => ceil($total / 30),
        'games' => $config['custom']['gamesArray']
      ))
    ), true);
    
  }
  
} else {
  
  Website::View('page', array(
    'title' => 'Unauthorized',
    'content' => Website::View('error/unauthorized')
  ), true);
  
}
